﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Revenue.ascx.cs" Inherits="CS424_9pts.Administration.Modules.Revenue" %>

<div class="section-header">
    <div class="title">
        <img src="../Common/ico-sales.png" alt="Revenue Report" />    
    </div>
    <div class="options">
    </div>
</div>

<asp:SqlDataSource ID="SqlDataSourceRevenue" runat="server" 
    ConnectionString="<%$ ConnectionStrings:CarManagementConnectionString %>" 
    SelectCommand="SELECT CarID, DatePurchased, ItemSubtotal, TotalPrice, CustomerID FROM Contracts">
</asp:SqlDataSource>

<asp:GridView ID="gvRevenue" runat="server" AllowPaging="True" 
    AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
    DataSourceID="SqlDataSourceRevenue" ForeColor="#333333" GridLines="None"
     ShowFooter="true" >
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:BoundField DataField="CarID" HeaderText="CarID" SortExpression="CarID" />
        <asp:BoundField DataField="DatePurchased" HeaderText="DatePurchased" 
            SortExpression="DatePurchased" />
        <asp:BoundField DataField="ItemSubtotal" HeaderText="ItemSubtotal" 
            SortExpression="ItemSubtotal" />
        <asp:BoundField DataField="TotalPrice" HeaderText="TotalPrice" 
            SortExpression="TotalPrice" />
        <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" 
            SortExpression="CustomerID" />
    </Columns>
    <EditRowStyle BackColor="#2461BF" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#EFF3FB" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <SortedAscendingCellStyle BackColor="#F5F7FB" />
    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
    <SortedDescendingCellStyle BackColor="#E9EBEF" />
    <SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>

<script runat="server">
    decimal TotalUnitPrice;
    decimal GetUnitPrice(decimal Price)
    {
        TotalUnitPrice += Price;
        return Price;
    }
    decimal GetTotal()
    {
        return TotalUnitPrice;
    }
</script>